/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.repair.vo;

import cn.hutool.core.date.DateUtil;
import org.springblade.modules.repair.entity.MaintainPlanContentExt;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;

import java.util.Date;

/**
 * 视图实体类
 *
 * @author ysq
 * @since 2022-03-28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "MaintainPlanContentExtVO对象", description = "MaintainPlanContentExtVO对象")
public class MaintainPlanContentExtVO extends MaintainPlanContentExt {
	private static final long serialVersionUID = 1L;


	private Long planId;

	private Long elevatorId;

	private Date planDate;

	private Integer planStatus;

	private Date planCreateTime;

	/**
	 * 电梯状态： 1-正常,2-停梯
	 */
	private Integer elevatorStop;
	/**
	 * 问题描述项，dict_key拼接
	 */
	private String problemItem;

	/**
	 * 工单整体维修时长（毫秒）
	 */
	private Long orderTimeMillisecond;

	public Long getOrderTimeMillisecond() {
		if (this.getPlanCreateTime() != null && this.getPlanEndTime() != null) {
			this.orderTimeMillisecond = DateUtil.toInstant(this.getPlanEndTime()).toEpochMilli() -  DateUtil.toInstant(this.getPlanCreateTime()).toEpochMilli();
		}
		return orderTimeMillisecond;
	}

	/**
	 * 保养状态 : -1:无状态，1: 脱保，2: 在保（合同期内），3：在保（合同期外），4：在保（拟定保养）
	 */
	private Integer maintainStatus;

	/**
	 * 电梯用途 0-公用，1-私用
	 */
	private Integer elevatorUseType;
}
